<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head lang="en"
	th:replace="header/header :: header('公告-实体商户社群服务平台',
	'/assets/layui/css/layui.css,/assets/module/admin.css',
	'/assets/libs/index/app.js')">
</head>
<body class="theme-my" data-theme="theme-my">
<!-- 顶部导航-->
<div th:replace="common/index/indexbar :: indexbar"></div>

<!--头条主体-->
<div class="content">
    <div class="compNews wrapper contDiaryTop">
        <div class="compNewsCon">
            
            <div class="layui-tab layui-tab-vertical" lay-filter="tabfilter">
			    <ul class="layui-tab-title" style="background-color: #fff;">
			        <li class="layui-this" style="text-align: center;">公告</li>
			        <li style="text-align: center;">通知</li>
			    </ul>
			    <div class="layui-tab-content">
			        <div class="layui-tab-item layui-show">
			        	<div class="compNewsConFr">
			                <div class="compNewsConFr-Con">
			                    <div class="dynamicDia">
			                        <ul id="noticeUl"></ul>
			                    </div>
			                </div>
			            </div>
			        </div>
			        <div class="layui-tab-item">
			        	<div class="compNewsConFr">
			                <div class="compNewsConFr-Con">
			                    <div class="dynamicDia">
			                        <ul id="msgUl"></ul>
			                    </div>
			                </div>
			            </div>
			        </div>
			    </div>
			</div>
			
        </div>

    </div>
</div>

<!-- 回到顶部 -->
<div th:replace="common/channel/backTop :: backTop"></div>

<!-- 页脚 -->
<div th:replace="common/footer :: footer"></div>

<script type="text/html" id="noticeHtml">
<li class="dynamicDia-li dynamicDia-liBorder">
	<div class="dynamicDia-userInfo">
		<div class="dynamicDia-userInfoL">
			<span class="noticeTitle">公告</span>
			<a class="dynamicDia-userInfoA" href="/u/notice/{{d.mid}}"> 
				<span class="dynamicDia-userInfoAs">{{d.noticeTitle}}</span>
			</a>
		</div>
		<div class="dynamicDia-userInfoR">
			<span class="noticeitem-time">{{d.createTime}}</span>
		</div>
	</div> 
	<div class="dynamicDia-con">
		<div class="dynamicDia-Notice"></div>
	</div>
</li>
</script>

<script type="text/javascript">
	layui.use(['layer', 'form', 'formX', 'setter', 'mynotice', 'admin', 'ax', 'util', 'dataGrid', 'element'], function () {
	    var $ = layui.jquery;
	    var layer = layui.layer;
	    var form = layui.form;
	    var formX = layui.formX;
	    var setter = layui.setter;
	    var mynotice = layui.mynotice;
	    var admin = layui.admin;
	    var $ax = layui.ax;
	    var util = layui.util;
	    var dataGrid = layui.dataGrid;
	    var element = layui.element;
	    
	    var Msg = {
	    	ins: {},
	    	ins2: {},
	    	dataGridRenderNotice:() => { // 渲染数据公告列表
	    		Msg.ins = dataGrid.render({
	    	        elem: '#noticeUl',  // 容器
	    	        templet: '#noticeHtml',  // 模板
	    	        url: '/zp/notice/uclist',  // 数据接口
	    	        page: {limit: 10},  // 开启分页
	    	        parseData: function(res){
	    	        	$.each(res.data, (i, v) => {
	    	        		v.createTime = util.toDateString(v.createTime, 'yyyy-MM-dd');
	    	        	})
	    	        	return res;
	    	        },
	    	        done: function(res, curr, count){
	    	        	
	    	        }
	    	    });
	    		dataGrid.on('tool(noticeUl)', function (obj) {
	                var modeldata = obj.data;
	                if (obj.event === 'xtzx') {
	                	
	                }
	            });
	    	},
	    	dataGridRenderMsg:() => { // 渲染数据公告列表
	    		Msg.ins2 = dataGrid.render({
	    	        elem: '#msgUl',  // 容器
	    	        templet: '#noticeHtml',  // 模板
	    	        url: '/zp/notice/umlist',  // 数据接口
	    	        page: {limit: 10},  // 开启分页
	    	        done: function(res, curr, count){
	    	        	
	    	        }
	    	    });
	    		dataGrid.on('tool(msgUl)', function (obj) {
	                var modeldata = obj.data;
	                if (obj.event === 'xtzx') {
	                	
	                }
	            });
	    	}
	    }
	    
	    Msg.dataGridRenderNotice();
	    
	    element.on('tab(tabfilter)', function(data){
	    	  if(data.index == 0){
	    		  Msg.dataGridRenderNotice();
	    	  }
	    	  if(data.index == 0){
	    		  Msg.dataGridRenderMsg();
	    	  }
	    });
	    
	});
</script>

</body>
</html>